home *** CD-ROM | disk | FTP | other *** search
- /*
- ** AGA PixelList Demo
- ** ------------------
- **
- ** To compile with SAS/C:
- **
- ** 1> sc PixelList.c link startup=LIB:gms.o data=far
- */
-
- #include <proto/games.h>
-
- extern struct GMSBase *GMSBase;
- ULONG _XCEXIT = NULL;
- ULONG PREFSNAME = DEFAULT;
-
- #define AMT_PIXELS 32
-
- ULONG Palette[] = {
- 0x000000,0x101010,0x171717,0x202020,0x272727,0x303030,0x373737,0x404040,
- 0x474747,0x505050,0x575757,0x606060,0x676767,0x707070,0x777777,0x808080,
- 0x878787,0x909090,0x979797,0xa0a0a0,0xa7a7a7,0xb0b0b0,0xb7b7b7,0xc0c0c0,
- 0xc7c7c7,0xd0d0d0,0xd7d7d7,0xe0e0e0,0xe0e0e0,0xf0f0f0,0xf7f7f7,0xffffff
- };
-
- struct PixelEntry Pixels[AMT_PIXELS] = {
- 160,128,0, 160,128,1, 160,128,2, 160,128,3, 160,128,4, 160,128,5,
- 160,128,6, 160,128,7, 160,128,8, 160,128,9, 160,128,10, 160,128,11,
- 160,128,12, 160,128,13, 160,128,14, 160,128,15, 160,128,16, 160,128,17,
- 160,128,18, 160,128,19, 160,128,20, 160,128,21, 160,128,22, 160,128,23,
- 160,128,24, 160,128,25, 160,128,26, 160,128,27, 160,128,28, 160,128,29,
- 160,128,30, 160,128,31
- };
-
- struct PixelList PixelList = {
- AMT_PIXELS,
- sizeof(struct PixelEntry),
- Pixels
- };
-
- struct GameScreen *GameScreen;
-
- /*=========================================================================*/
-
- void main(void)
- {
- UWORD i;
- ULONG mouse;
-
- if (AllocBlitter() == NULL) {
- if (GameScreen = AddScreenTags(TAGS_GAMESCREEN,NULL,
- GSA_AmtColours,32,
- GSA_Palette,Palette,
- GSA_Attrib,DBLBUFFER,
- TAGEND)) {
-
- InitJoyPorts();
- ShowScreen(GameScreen);
-
- do {
- ClrScreen(GameScreen,BUFFER2);
-
- for(i=0; i<(AMT_PIXELS-1); i++) {
- Pixels[i].YCoord += 1; /* Y Coord down 1 */
- if ((Pixels[i].Colour -= 1) < 0) /* Colour value down 1 */
- Pixels[i].Colour = 1;
- }
-
- mouse = ReadJoyPort(JPORT1,JT_ZBXY);
- Pixels[AMT_PIXELS-1].XCoord += (BYTE)(mouse>>8)+(FastRandom(3)-1);
- Pixels[AMT_PIXELS-1].YCoord += (BYTE)(mouse)+(FastRandom(3)-1);
-
- for(i=0; i<(AMT_PIXELS-1); i++)
- Pixels[i] = Pixels[i+1];
-
- DrawPixelList(GameScreen,BUFFER2,&PixelList);
- WaitVBL();
- SwapBuffers(GameScreen);
- } while (!(mouse & MB_LMB));
-
- DeleteScreen(GameScreen);
- }
- FreeBlitter();
- }
- }
-
-